/**
 * Created by yangwenxin on 17/2/15.
 */


$.getJSON('data.json', function(data){
    for (var i = 0; i < data.pages.length; i++) {
        var m=i+1;
        $("#page"+i).append(
            '<img src="' + data.next.icon + '" class="next">'
        );
        for(var j=0;j<data.pages[i].blocks.length;j++){
            var n=j+1;
            $('#block'+'-'+m+'-'+n).css("animation-duration",data.pages[i].blocks[j].animationDuration);
            $('#block'+'-'+m+'-'+n).css("animation-delay",data.pages[i].blocks[j].animationDelay);
            $('#block'+'-'+m+'-'+n).addClass(data.pages[i].blocks[j].animationName +' '+ data.pages[i].blocks[j].animationTimingFunction /*+' '+data.pages[i].blocks[j].animationDuration*/);
        }

    }
});

$(document).ready(function () {

    $('#all').bind('touchstart',test);

    function test(event) {

        var arr = $("#all>section");
        for (var i = 0; i < arr.length-1; i++) {
            if ((arr[i].style.display == "block"||arr[i].style.display == "") ) {
                arr[i+1].style.display = "block";
                arr[i].style.display = "none";
                break;
            }
            var m = i + 1;
        }
    }})
